home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / assert.h,v < prev    next >
Encoding:
Text File  |  1991-11-18  |  3.9 KB  |  231 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.6.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     90.11.06.17.21.14;  author rab;  state Exp;
  11. branches 1.6.1.1;
  12. next     1.5;
  13.  
  14. 1.5
  15. date     89.08.18.11.45.04;  author rab;  state Exp;
  16. branches ;
  17. next     1.4;
  18.  
  19. 1.4
  20. date     89.02.14.23.41.29;  author rab;  state Exp;
  21. branches ;
  22. next     1.3;
  23.  
  24. 1.3
  25. date     89.01.06.07.05.25;  author rab;  state Exp;
  26. branches ;
  27. next     1.2;
  28.  
  29. 1.2
  30. date     88.06.29.14.57.50;  author ouster;  state Exp;
  31. branches ;
  32. next     1.1;
  33.  
  34. 1.1
  35. date     88.06.21.16.42.07;  author ouster;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39. 1.6.1.1
  40. date     91.11.18.15.50.25;  author kupfer;  state Exp;
  41. branches ;
  42. next     ;
  43.  
  44.  
  45. desc
  46. @@
  47.  
  48.  
  49. 1.6
  50. log
  51. @Changed extern to _EXTERN for g++.
  52. @
  53. text
  54. @/*
  55.  * assert.h --
  56.  *
  57.  *  Definition of assert() macro.
  58.  *
  59.  * Copyright 1988 Regents of the University of California
  60.  * Permission to use, copy, modify, and distribute this
  61.  * software and its documentation for any purpose and without
  62.  * fee is hereby granted, provided that the above copyright
  63.  * notice appear in all copies.  The University of California
  64.  * makes no representations about the suitability of this
  65.  * software for any purpose.  It is provided "as is" without
  66.  * express or implied warranty.
  67.  *
  68.  * $Header: /sprite/src/lib/include/RCS/assert.h,v 1.5 89/08/18 11:45:04 rab Exp Locker: rab $
  69.  */
  70.  
  71. #include <cfuncproto.h>
  72.  
  73. #ifdef assert
  74. #undef assert
  75. #endif
  76.  
  77. #ifdef _assert
  78. #undef _assert
  79. #endif
  80.  
  81. #ifndef NDEBUG
  82. #ifdef KERNEL
  83. #ifdef __STDC__
  84.  
  85. #define _assert(ex) { if (!(ex)) { panic(\
  86.     "Assertion failed: (" #ex ") file \"%s\", line %d\n", __FILE__, __LINE__);}}
  87.  
  88. #else /* __STDC__ */
  89.  
  90. #define _assert(ex) { if (!(ex)) { panic(\
  91.     "Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);}}
  92. #endif /* __STDC__ */
  93.  
  94. #else /* KERNEL */
  95.  
  96. _EXTERN void __eprintf _ARGS_ ((_CONST char *string,
  97.     int line, _CONST char *filename));
  98.  
  99. #ifdef __STDC__
  100.  
  101. #define _assert(ex) { if (!(ex)) { __eprintf( \
  102.     "Assertion failed: (" #ex ") line %d of \"%s\"\n", __LINE__, __FILE__);\
  103.     abort();}}
  104.  
  105. #else /* __STDC__ */
  106.  
  107. #define _assert(ex) { if (!(ex)) { __eprintf( \
  108.     "Assertion failed: line %d of \"%s\"\n", __LINE__, __FILE__);\
  109.     abort();}}
  110.  
  111. #endif /* __STDC__ */
  112.  
  113. #endif /* KERNEL */
  114.  
  115. # define assert(ex)    _assert(ex)
  116. # else  /* !NDEBUG */
  117. # define _assert(ex)
  118. # define assert(ex)
  119. # endif /* !NDEBUG */
  120.  
  121. @
  122.  
  123.  
  124. 1.6.1.1
  125. log
  126. @Initial branch for Sprite server.
  127. @
  128. text
  129. @d15 1
  130. a15 1
  131.  * $Header: /sprite/src/lib/include/RCS/assert.h,v 1.6 90/11/06 17:21:14 rab Exp $
  132. @
  133.  
  134.  
  135. 1.5
  136. log
  137. @Modified macros to use gnulib eprintf().
  138. @
  139. text
  140. @d15 1
  141. a15 1
  142.  * $Header: /sprite/src/lib/include/RCS/assert.h,v 1.4 89/02/14 23:41:29 rab Exp Locker: rab $
  143. d18 2
  144. d39 1
  145. d41 1
  146. a41 1
  147. #endif /* __STDC__ */
  148. d43 2
  149. a45 1
  150. #else /* KERNEL */
  151. a47 2
  152. extern void __eprintf(const char *string, int line, const char *filename);
  153.  
  154. a52 2
  155.  
  156. extern void __eprintf();
  157. @
  158.  
  159.  
  160. 1.4
  161. log
  162. @Fixed assert macro to call `panic' if used in the kernel.
  163. @
  164. text
  165. @d15 1
  166. a15 1
  167.  * $Header: /sprite/src/lib/include/RCS/assert.h,v 1.3 89/01/06 07:05:25 rab Exp Locker: rab $
  168. d44 4
  169. a47 2
  170. #define _assert(ex) { if (!(ex)) { (void) fprintf(stderr,\
  171.     "Assertion failed: (" #ex ") file \"%s\", line %d\n", __FILE__, __LINE__);\
  172. d52 4
  173. a55 2
  174. #define _assert(ex) { if (!(ex)) { (void) fprintf(stderr,\
  175.     "Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);\
  176. @
  177.  
  178.  
  179. 1.3
  180. log
  181. @Fixed assert() to call abort instead of exit.
  182. @
  183. text
  184. @d15 1
  185. a15 1
  186.  * $Header$
  187. d27 1
  188. d30 14
  189. d55 3
  190. @
  191.  
  192.  
  193. 1.2
  194. log
  195. @Add ifdefs so that file can't be processed twice.
  196. @
  197. text
  198. @d1 15
  199. a15 3
  200. /*    assert.h    4.2    85/01/21    */
  201. /* This file was taken from BSD and has AT&T roots.  Because of this it
  202.  * cannot be redistributed except to properly licensed sites.
  203. d18 3
  204. a20 2
  205. #ifndef _ASSERT
  206. #define _ASSERT
  207. d22 18
  208. a39 2
  209. # ifndef NDEBUG
  210. # define _assert(ex)    {if (!(ex)){fprintf(stderr,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);exit(1);}}
  211. d41 1
  212. a41 1
  213. # else
  214. d44 1
  215. a44 1
  216. # endif
  217. a45 1
  218. #endif _ASSERT
  219. @
  220.  
  221.  
  222. 1.1
  223. log
  224. @Initial revision
  225. @
  226. text
  227. @d2 3
  228. d6 3
  229. d16 2
  230. @
  231.